package com.google.zxing.client.ohos.camera;

import ohos.media.image.common.Size;

import java.util.List;

public class CameraConfigurationUtil {
    public static Size getBestSize(List<Size> sizes,int width,int height){
        Size size = null;
        float rate = Integer.MAX_VALUE;
        for (Size curSize:sizes){
            float mRate = Math.max(Math.abs(curSize.width/(float)width),Math.abs(curSize.height/(float)height));
            if (rate>mRate){
                size = curSize;
                rate = mRate;
            }
        }
        return size;



    }
}
